<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>编辑清单行</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">

        <div class="block-generic">
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>基本信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-block">
                            <input type="text" id="encode" placeholder="请输入" readonly  autocomplete="off" class="layui-input readonly">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>项目名称</label>
                        <div class="layui-input-block">
                            <input type="text" id="enname" placeholder="请输入" readonly  autocomplete="off" class="layui-input readonly">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">项目特征描述</label>
                        <div class="layui-input-block">
                            <input type="text" id="enfeat" placeholder="请输入" readonly  autocomplete="off" class="layui-input readonly">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>计量单位</label>
                        <div class="layui-input-block">
                            <input type="text" id="enunit" placeholder="请输入" readonly  autocomplete="off" class="layui-input readonly">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>工程量</label>
                        <div class="layui-input-block">
                            <input type="text" name="enword" id="enword" placeholder="请输入" clearable  autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<script>

    var param_id = getQueryVariable('id') || 0;
    $("#commentForm").validate({
        rules: {
            enname: {required: true},
            enunit: {required: true},
            enword: {required: true},
        },
        messages:{
            enname: {required: "请输入"},
            enunit: {required: "请输入"},
            enword: {required: "请输入"},
        }
    });


    var jietype;
    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_main_qing_edithang, data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                $("#encode").val(data.encode);
                $("#enname").val(data.enname);
                $("#enfeat").val(data.enfeat);
                $("#enunit").val(data.enunit);
                $("#enword").val(data.enword);


                render_date();
                render_from();
            }
        });

        form.on('submit(add)', function(data){
            var validRes = $("#commentForm").valid();
            if(!validRes){return false;}

            data.field.id = param_id;
            facade.ajax({url: ask_main_qing_edithang, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });


</script>
</body>
</html>
